package org.jeecg.modules.common;

import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.constant.RedisConstant;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Set;

/**
 * TODO: 每天0点删除阅读set缓存，更新用户阅读可以增加积分的接口
 *
 * @author Zhang Hao yu
 * @date 2021/01/17 17:14
 */
@Slf4j
public class ReloadJob implements Job {
    @Autowired
    private RedisUtil redisUtil;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        Set<String> keys = redisUtil.keys(RedisConstant.READING + "*");
        redisUtil.deleteAll(keys);
    }
}
